package org.finesys.chat.core.base.embedding.store.pgvector.filter;

public class JSONFilterMapper extends PgVectorFilterMapper {

    private final String metadataColumnName;

    public JSONFilterMapper(String metadataColumnName) {
        this.metadataColumnName = metadataColumnName;
    }

    public String formatKey(String key, Class<?> valueType) {
        return String.format("(%s->>'%s')::%s", metadataColumnName, key, SQL_TYPE_MAP.get(valueType));
    }

    public String formatKeyAsString(String key) {
        return String.format("(%s->>'%s')", metadataColumnName, key);
    }
}
